package com.qlslylq.ad.sdk.model.req;

import com.qlslylq.ad.sdk.constant.AppConst;
import com.qlslylq.ad.sdk.enums.AdEventSign;
import com.qlslylq.ad.sdk.enums.AdPlatformEnum;
import com.qlslylq.ad.sdk.enums.OsType;
import com.qlslylq.ad.sdk.method.AppMethod;
import com.qlslylq.ad.sdk.model.rsp.AdPlaceWebConfigureVO;

import java.io.Serializable;

/**
 * 添加埋点数据<br/>
 */
public class UserBehaviorAddDTO implements Serializable {

    private long adPlaceId;

    private long adSourceId;

    private String platformSign;

    private String callType;

    private String positionId;

    private String userCode;

    private int osType;

    private String version;

    private String sdkVersion;

    public UserBehaviorAddDTO(long adPlaceId, long adSourceId, String platformSign, String callType, String positionId, String userCode, int osType, String version, String sdkVersion) {
        this.adPlaceId = adPlaceId;
        this.adSourceId = adSourceId;
        this.platformSign = platformSign;
        this.callType = callType;
        this.positionId = positionId;
        this.userCode = userCode;
        this.osType = osType;
        this.version = version;
        this.sdkVersion = sdkVersion;
    }

    public long getAdPlaceId() {
        return adPlaceId;
    }

    public void setAdPlaceId(long adPlaceId) {
        this.adPlaceId = adPlaceId;
    }

    public long getAdSourceId() {
        return adSourceId;
    }

    public void setAdSourceId(long adSourceId) {
        this.adSourceId = adSourceId;
    }

    public String getPlatformSign() {
        return platformSign;
    }

    public void setPlatformSign(String platformSign) {
        this.platformSign = platformSign;
    }

    public String getCallType() {
        return callType;
    }

    public void setCallType(String callType) {
        this.callType = callType;
    }

    public String getPositionId() {
        return positionId;
    }

    public void setPositionId(String positionId) {
        this.positionId = positionId;
    }

    public String getUserCode() {
        return userCode;
    }

    public void setUserCode(String userCode) {
        this.userCode = userCode;
    }

    public int getOsType() {
        return osType;
    }

    public void setOsType(int osType) {
        this.osType = osType;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getSdkVersion() {
        return sdkVersion;
    }

    public void setSdkVersion(String sdkVersion) {
        this.sdkVersion = sdkVersion;
    }

    /**
     * 构造埋点模型<br/>
     */
    public static UserBehaviorAddDTO build(AdPlaceWebConfigureVO item, AdEventSign eventSign, long adPlaceId) {
        return new UserBehaviorAddDTO(adPlaceId, item.getAdSourceId(), item.getPlatform().getName(), eventSign.getName(), item.getPositionId(), AppMethod.getDeviceId(), OsType.Android.getId(), AppConst.SERVER_API_VERSION + "_" + AppConst.SDK_API_VERSION, AppConst.SDK_API_VERSION);
    }
}
